package com.gtw;

import com.gtw.command.*;

public class Client {

    public static void main(String[] args){
        //声明调用者
        Invoker invoker = new Invoker();
        //声明执行者
        Receiver receiver1 = new ConcreteReceiver1();
        Receiver receiver2 = new ConcreteReceiver2();

        //发布命令(指定命令由谁去做)
        Command command1 = new ConcreteCommand(receiver1);
        Command command2 = new ConcreteCommand(receiver2);

        //命令给调用者,调用者决定命令开始执行
        invoker.setCommand(command1);
        invoker.action();
        invoker.setCommand(command2);
        invoker.action();
    }
}
